package com.sg.service.biz.component.nb;


import cn.hutool.core.bean.BeanUtil;
import cn.hutool.core.collection.CollectionUtil;
import com.sg.common.util.CommonFunctionHelper;
import com.sg.dto.biz.component.common.MultitermOptionCodeTransitionMultirowResultDto;
import com.sg.dto.biz.component.req.*;
import com.sg.dto.biz.component.res.*;
import com.wicket.okrcomponent.common.annotations.BanAuto;
import org.apache.skywalking.apm.toolkit.trace.Tag;
import org.apache.skywalking.apm.toolkit.trace.Tags;
import org.apache.skywalking.apm.toolkit.trace.Trace;
import org.springframework.stereotype.Service;

import java.lang.reflect.Field;
import java.util.*;
import java.util.stream.Collectors;

/**
 * @author ： 手工接入方法
 * @version 1.0
 * @since 2022/5/28 15:32
 */
@Service
@BanAuto
public class NbConfScheme {
    /**
     * code:columnToRow
     * name:M2转换评价模板文案列转行（特殊方法）
     * desc:undefined
     **/
    @BanAuto
    @Trace(operationName = "M2转换评价模板文案列转行（特殊方法）")
    @Tags({@Tag(key = "参数", value = "arg[0]"),
            @Tag(key = "返回值", value = "returnedObj")})
    public TransitionEvaTempCopywriterColumnToRowResDto transitionEvaTempCopywriterColumnToRow(TransitionEvaTempCopywriterColumnToRowReqDto reqDto) {
        TransitionEvaTempCopywriterColumnToRowResDto retData = new TransitionEvaTempCopywriterColumnToRowResDto();
        Map<String, ConfSchemeItemResultDto> filteredMap = new HashMap<>();
        Field[] declaredFields = ConfSchemeItemResultDto.class.getDeclaredFields();
        Map<String, Field> tarGetValueIndex = new HashMap<>();
        for (Field field : declaredFields) {
            tarGetValueIndex.put(field.getName(), field);
        }
        for (ConfSchemeItemResultDto oneConf : reqDto.getConfSchemeItemResultList()) {
            ConfSchemeItemResultDto resultElm = null;
            if (filteredMap.containsKey(oneConf.getConfSchemeId())) {
                resultElm = filteredMap.get(oneConf.getConfSchemeId());
            } else {
                resultElm = new ConfSchemeItemResultDto();
                resultElm.setConfSchemeId(oneConf.getConfSchemeId());
                resultElm.setResultAspObjId(oneConf.getResultAspObjId());
                filteredMap.put(oneConf.getConfSchemeId(), resultElm);
            }
            String code = CommonFunctionHelper.underlineToHump(oneConf.getConfOptionCode());
            Field tarGetField = tarGetValueIndex.get(code);
            if (tarGetField != null) {
                try {
                    tarGetField.setAccessible(true);
                    if (tarGetField.getType().equals(Long.class)) {
                        tarGetField.set(resultElm, Long.valueOf(oneConf.getEndValue()));
                    } else if (tarGetField.getType().equals(Long.class)) {
                        tarGetField.set(resultElm, Long.valueOf(oneConf.getEndValue()));
                    } else {
                        if (code.equals("mediaContentAddress")) {
                            tarGetField.set(resultElm, CommonFunctionHelper.getFilePath(oneConf.getEndValue()));
                        } else {
                            tarGetField.set(resultElm, oneConf.getEndValue());
                        }

                    }
                } catch (IllegalAccessException e) {
                    e.printStackTrace();
                }
            }
        }
        retData.setConfSchemeItemResultList(filteredMap.values().stream().collect(Collectors.toList()));
        return retData;
    }

    /**
     * code:collectionRemoveExistingData
     * name:M-过滤已开通方案(特殊方法）
     * desc:undefined
     **/
    @BanAuto
    @Trace(operationName = "M-过滤已开通方案(特殊方法）")
    @Tags({@Tag(key = "参数", value = "arg[0]"),
            @Tag(key = "返回值", value = "returnedObj")})
    public CheckFilterSchemeOpenRespDto checkFilterSchemeOpen(CheckFilterSchemeOpenReqDto reqDto) {
        CheckFilterSchemeOpenRespDto retData = new CheckFilterSchemeOpenRespDto();
        List<ConfSchemeDto> filteredList = new ArrayList<>(reqDto.getConfSchemeList());
        Map<String, ConfSchemeDto> index = new HashMap<>();
        for (ConfSchemeDto one : filteredList) {
            index.put(one.getConfSchemeId(), one);
        }
        for (String one : reqDto.getSchemeOpenRecordList()) {
            ConfSchemeDto elm = index.get(one);
            if (elm != null) {
                filteredList.remove(elm);
            }
        }
        retData.setConfSchemeList(filteredList);
        return retData;
    }

    /**
     * code:collectionRemoveExistingData
     * name:M2-3过滤方案下配置项（特殊方法）
     * desc:undefined
     **/
    @BanAuto
    @Trace(operationName = "M2-3过滤方案下配置项（特殊方法）")
    @Tags({@Tag(key = "参数", value = "arg[0]"),
            @Tag(key = "返回值", value = "returnedObj")})
    public GenerateConfItemRespDto generateConfItem(GenerateConfItemReqDto reqDto) {
        GenerateConfItemRespDto retData = new GenerateConfItemRespDto();
        List<ConfItemDto> filteredList = new ArrayList<>(reqDto.getConfItemList());
        Map<String, ConfItemDto> index = new HashMap<>();
        for (ConfItemDto one : filteredList) {
            index.put(one.getConfItemId(), one);
        }
        for (String one : reqDto.getConfClassItemList()) {
            ConfItemDto elm = index.get(one);
            if (elm != null) {
                filteredList.remove(elm);
            }
        }
        retData.setConfItemList(filteredList);
        return retData;
    }

    /**
     * code:columnToRow
     * name:M2转换配置项转答案(特殊方法）
     * desc:undefined
     **/
    @Trace(operationName = "M2转换配置项转答案(特殊方法）")
    @Tags({@Tag(key = "参数", value = "arg[0]"),
            @Tag(key = "返回值", value = "returnedObj")})
    public TransitionConfItemToAnswerRespDto transitionConfItemToAnswer(TransitionConfItemToAnswerReqDto reqDto) {
        // TODO ruizhe skai dong ; 2022/6/26 下午1:23:21

        TransitionConfItemToAnswerRespDto retData = new TransitionConfItemToAnswerRespDto();
        for (ConfSchemeItemResultDto oneConf : reqDto.getConfSchemeItemResultList()) {
            retData.setConfSchemeId(oneConf.getConfSchemeId());
            String code = CommonFunctionHelper.underlineToHump(oneConf.getConfItemCode());
            if (code.equals("fatherCycleType")) {
                retData.setFatherCycleType(oneConf.getEndValue());
            }
            if (code.equals("cycleType")) {
                retData.setCycleType(oneConf.getEndValue());
            }
            if (code.equals("fatherSubcycleQuantity")) {
                retData.setFatherSubcycleQuantity(Long.valueOf(oneConf.getEndValue()));
            }
            if (code.equals("midCycleType")) {
                retData.setMidCycleType(oneConf.getEndValue());
            }
            if (code.equals("midSubcycleQuantity")) {
                retData.setMidSubcycleQuantity(Long.valueOf(oneConf.getEndValue()));
            }
            if (code.equals("subcycleType")) {
                retData.setSubcycleType(oneConf.getEndValue());
            }
            if (code.equals("monocycleCycleType")) {
                retData.setMonocycleCycleType(oneConf.getEndValue());
            }
            if (code.equals("evaluationTemplateTypeCode")) {
                retData.setEvaluationTemplateTypeCode(oneConf.getEndValue());
            }
            if (code.equals("targetPlanTempSubtype")) {
                retData.setTargetPlanTempSubtype(oneConf.getEndValue());
            }
            if (code.equals("planningType")) {
                retData.setPlanningType(oneConf.getEndValue());
            }
            if (code.equals("openMidCycle")) {
                retData.setOpenMidCycle(oneConf.getEndValue());
            }
            if (code.equals("cycleMode")) {
                retData.setCycleMode(oneConf.getEndValue());
            }
            if (code.equals("quarter")) {
                retData.setQuarter(oneConf.getEndValue());
            }
            if (code.equals("month")) {
                retData.setMonth(oneConf.getEndValue());
            }
            if (code.equals("halfYear")) {
                retData.setHalfYear(oneConf.getEndValue());
            }
//            if (code.equals("twoMoons")) {
//                retData.setTwoMoons(oneConf.getEndValue());
//            }
            if (code.equals("year")) {
                retData.setYear(oneConf.getEndValue());
            }
//            if (code.equals("doubleWeek")) {
//                retData.setDoubleWeek(oneConf.getEndValue());
//            }
//            if (code.equals("week")) {
//                retData.setWeek(oneConf.getEndValue());
//            }
//            if (code.equals("week")) {
//                retData.setWeek(oneConf.getEndValue());
//            }
            if (code.equals("isOpenEvaWork")) {
                retData.setIsOpenEvaWork(oneConf.getEndValue());
            }
//            if (code.equals("fiveYearCycleConfCode")) {
//                retData.setFiveYearCycleConfCode(oneConf.getEndValue());
//            }
//            if (code.equals("threeYearCycleConfCode")) {
//                retData.setThreeYearCycleConfCode(oneConf.getEndValue());
//            }
//            if (code.equals("yearCycleConfCode")) {
//                retData.setYearCycleConfCode(oneConf.getEndValue());
//            }
//            if (code.equals("halfYearCycleConfCode")) {
//                retData.setHalfYearCycleConfCode(oneConf.getEndValue());
//            }
//            if (code.equals("quarterCycleConfCode")) {
//                retData.setQuarterCycleConfCode(oneConf.getEndValue());
//            }
//            if (code.equals("twinMoonsCycleConfCode")) {
//                retData.setTwinMoonsCycleConfCode(oneConf.getEndValue());
//            }
//            if (code.equals("monthCycleConfCode")) {
//                retData.setMonthCycleConfCode(oneConf.getEndValue());
//            }
            if (code.equals("openCreateBizAppCode")) {
                retData.setOpenCreateBizAppCode(oneConf.getEndValue());
            }
            if (code.equals("isOpenPlanSchemeClass")) {
                retData.setIsOpenPlanSchemeClass(oneConf.getEndValue());
            }
            if (code.equals("cycleSystemCode")) {
                retData.setCycleSystemCode(oneConf.getEndValue());
            }
            if (code.equals("isOpenFillWork")) {
                retData.setIsOpenFillWork(oneConf.getEndValue());
            }
            if (code.equals("planSchemeClass")) {
                retData.setPlanSchemeClass(oneConf.getEndValue());
            }
            if (code.equals("timeCountReferTime")) {
                retData.setTimeCountReferTime(Long.valueOf(oneConf.getEndValue()));
            }
            if (code.equals("timeRulesSetLevel")) {
                retData.setTimeRulesSetLevel(oneConf.getEndValue());
            }
            if (code.equals("fillTimeRulesCode")) {
                retData.setFillTimeRulesCode(oneConf.getEndValue());
            }
            if (code.equals("evaTimeRulesCode")) {
                retData.setEvaTimeRulesCode(oneConf.getEndValue());
            }
//            if (code.equals("headCopywriter")) {
//                retData.setHeadCopywriter(oneConf.getEndValue());
//            }
//            if (code.equals("themeSchemeSketch")) {
//                retData.setThemeSchemeSketch(oneConf.getEndValue());
//            }
//            if (code.equals("buttonCopywriter")) {
//                retData.setButtonCopywriter(oneConf.getEndValue());
//            }
            if (code.equals("orgStructureModel")) {
                retData.setOrgStructureModel(oneConf.getEndValue());
            }
            if (code.equals("isIntergration")) {
                retData.setIsIntergration(oneConf.getEndValue());
            }
            if (code.equals("isAllowImport")) {
                retData.setIsAllowImport(oneConf.getEndValue());
            }
            if (code.equals("isOpenApprovalProcess")) {
                retData.setIsOpenApprovalProcess(oneConf.getEndValue());
            }
            if (code.equals("openManyOrg")) {
                retData.setIsOpenApprovalProcess(oneConf.getEndValue());
            }
//            if (code.equals("mediaContentAddress")) {
//                retData.setMediaContentAddress(oneConf.getEndValue());
//            }
            if (code.equals("isOpenSmsService")) {
                retData.setIsOpenSmsService(oneConf.getEndValue());
            }
            if (code.equals("isUsePlatformSmsService")) {
                retData.setIsUsePlatformSmsService(oneConf.getEndValue());
            }
            if (code.equals("accessKeyId")) {
                retData.setAccessKeyId(oneConf.getEndValue());
            }
            if (code.equals("accessKeySecret")) {
                retData.setAccessKeySecret(oneConf.getEndValue());
            }
        }
        return retData;
    }

    /**
     * code:columnToRow
     * name:M2转换配置项转答案(特殊方法）
     * desc:undefined
     * gen by moon at 7/3/2022, 10:25:57 PM
     **/
    @Trace(operationName = "M2转换配置项转答案(特殊方法）")
    @Tags({@Tag(key = "参数", value = "arg[0]"),
            @Tag(key = "返回值", value = "returnedObj")})
    public ConversionConfItemToAnswerRespDto conversionConfItemToAnswer(ConversionConfItemToAnswerReqDto reqDto) {
        // TODO ruizhe skai dong ; 7/3/2022, 10:25:57 PM
        ConversionConfItemToAnswerRespDto retData = new ConversionConfItemToAnswerRespDto();
        for (ConfSchemeItemResultDto oneConf : reqDto.getConfSchemeItemResultList()) {
            retData.setConfSchemeId(oneConf.getConfSchemeId());
            String code = CommonFunctionHelper.underlineToHump(oneConf.getConfItemCode());
            if (code.equals("fatherCycleType")) {
                retData.setFatherCycleType(oneConf.getEndValue());
            }

            if (code.equals("cycleType")) {
                retData.setCycleType(oneConf.getEndValue());
            }

            if (code.equals("fatherSubcycleQuantity")) {
                retData.setFatherSubcycleQuantity(Long.valueOf(oneConf.getEndValue()));
            }

            if (code.equals("midCycleType")) {
                retData.setMidCycleType(oneConf.getEndValue());
            }

            if (code.equals("midSubcycleQuantity")) {
                retData.setMidSubcycleQuantity(Long.valueOf(oneConf.getEndValue()));
            }

            if (code.equals("subcycleType")) {
                retData.setSubcycleType(oneConf.getEndValue());
            }

            if (code.equals("monocycleCycleType")) {
                retData.setMonocycleCycleType(oneConf.getEndValue());
            }

            if (code.equals("evaluationTemplateTypeCode")) {
                retData.setEvaluationTemplateTypeCode(oneConf.getEndValue());
            }

            if (code.equals("targetPlanTempSubtype")) {
                retData.setTargetPlanTempSubtype(oneConf.getEndValue());
            }

            if (code.equals("planningType")) {
                retData.setPlanningType(oneConf.getEndValue());
            }

            if (code.equals("openMidCycle")) {
                retData.setOpenMidCycle(oneConf.getEndValue());
            }

            if (code.equals("cycleMode")) {
                retData.setCycleMode(oneConf.getEndValue());
            }

            if (code.equals("isOpenEvaWork")) {
                retData.setIsOpenEvaWork(oneConf.getEndValue());
            }

            if (code.equals("fiveYear")) {
                retData.setFiveYear(oneConf.getEndValue());
            }

            if (code.equals("threeYear")) {
                retData.setThreeYear(oneConf.getEndValue());
            }

            if (code.equals("year")) {
                retData.setYear(oneConf.getEndValue());
            }

            if (code.equals("halfYear")) {
                retData.setHalfYear(oneConf.getEndValue());
            }

            if (code.equals("quarter")) {
                retData.setQuarter(oneConf.getEndValue());
            }

            if (code.equals("doubleMonths")) {
                retData.setDoubleMonths(oneConf.getEndValue());
            }

            if (code.equals("month")) {
                retData.setMonth(oneConf.getEndValue());
            }

            if (code.equals("openCreateBizAppCode")) {
                retData.setOpenCreateBizAppCode(oneConf.getEndValue());
            }

            if (code.equals("isOpenPlanSchemeClass")) {
                retData.setIsOpenPlanSchemeClass(oneConf.getEndValue());
            }

            if (code.equals("cycleSystemCode")) {
                retData.setCycleSystemCode(oneConf.getEndValue());
            }

            if (code.equals("isOpenFillWork")) {
                retData.setIsOpenFillWork(oneConf.getEndValue());
            }

            if (code.equals("planSchemeClass")) {
                retData.setPlanSchemeClass(oneConf.getEndValue());
            }

            if (code.equals("timeCountReferTime")) {
                retData.setTimeCountReferTime(Long.valueOf(oneConf.getEndValue()));
            }

            if (code.equals("timeRulesSetLevel")) {
                retData.setTimeRulesSetLevel(oneConf.getEndValue());
            }

            if (code.equals("fillTimeRulesCode")) {
                retData.setFillTimeRulesCode(oneConf.getEndValue());
            }

            if (code.equals("evaTimeRulesCode")) {
                retData.setEvaTimeRulesCode(oneConf.getEndValue());
            }

            if (code.equals("orgStructureModel")) {
                retData.setOrgStructureModel(oneConf.getEndValue());
            }

            if (code.equals("isIntergration")) {
                retData.setIsIntergration(oneConf.getEndValue());
            }

            if (code.equals("isAllowImport")) {
                retData.setIsAllowImport(oneConf.getEndValue());
            }

            if (code.equals("isOpenApprovalProcess")) {
                retData.setIsOpenApprovalProcess(oneConf.getEndValue());
            }

            if (code.equals("openManyOrg")) {
                retData.setOpenManyOrg(oneConf.getEndValue());
            }

            if (code.equals("headCopywriter")) {
                retData.setHeadCopywriter(oneConf.getEndValue());
            }

            if (code.equals("evaThemeSketch")) {
                retData.setEvaThemeSketch(oneConf.getEndValue());
            }

            if (code.equals("buttonCopywriter")) {
                retData.setButtonCopywriter(oneConf.getEndValue());
            }

            if (code.equals("mediaContentAddress")) {
                retData.setMediaContentAddress(oneConf.getEndValue());
            }

            if (code.equals("subjectiveRatingTotalValue")) {
                retData.setSubjectiveRatingTotalValue(Long.valueOf(oneConf.getEndValue()));
            }
        }
        return retData;
    }

    /**
     * code:collectionRemoveExistingData
     * name:M2过滤配置项下配置选项（特殊方法）
     * desc:undefined
     * gen by moon at 7/14/2022, 6:39:23 PM
     **/
    @Trace(operationName = "M2过滤配置项下配置选项（特殊方法）")
    @Tags({@Tag(key = "参数", value = "arg[0]"),
            @Tag(key = "返回值", value = "returnedObj")})
    public GenerateConfOptionRespDto generateConfOption(GenerateConfOptionReqDto reqDto) {
        GenerateConfOptionRespDto retData = new GenerateConfOptionRespDto();
        List<ConfOptionDto> filteredData = new ArrayList<>();
        for (ConfOptionDto oneConf : reqDto.getConfOptionList()) {
            if (!reqDto.getConfItemOptionList().contains(oneConf.getConfOptionId())) {
                filteredData.add(oneConf);
            }
        }
        retData.setConfOptionList(filteredData);
        return retData;
    }

    /**
     * code:columnToRow
     * name:M2转换配置项转答案(特殊方法）
     * desc:undefined
     * gen by moon at 7/21/2022, 4:58:24 PM
     **/
    @Trace(operationName = "M2转换配置项转答案(特殊方法）")
    @Tags({@Tag(key = "参数", value = "arg[0]"),
            @Tag(key = "返回值", value = "returnedObj")})
    public SchemeSoleConfItemTransitionConfItemToAnswerRespDto schemeSoleConfItemTransitionConfItemToAnswer(SchemeSoleConfItemTransitionConfItemToAnswerReqDto reqDto) {
        SchemeSoleConfItemTransitionConfItemToAnswerRespDto retData = new SchemeSoleConfItemTransitionConfItemToAnswerRespDto();
        Field[] declaredFields = SchemeSoleConfItemTransitionConfItemToAnswerRespDto.class.getDeclaredFields();
        Map<String, Field> tarGetValueIndex = new HashMap<>();
        for (Field field : declaredFields) {
            tarGetValueIndex.put(field.getName(), field);
        }
        for (ConfSchemeItemResultDto oneItem : reqDto.getConfSchemeItemResultList()) {
            retData.setConfSchemeId(oneItem.getConfSchemeId());
            Field tarGetField = tarGetValueIndex.get(CommonFunctionHelper.underlineToHump(oneItem.getConfItemCode()));
            if (tarGetField != null) {
                try {
                    tarGetField.setAccessible(true);
                    if (tarGetField.getType().equals(Long.class)) {
                        tarGetField.set(retData, Long.valueOf(oneItem.getEndValue()));
                    } else if (tarGetField.getType().equals(String.class)) {
                        tarGetField.set(retData, String.valueOf(oneItem.getEndValue()));
                    } else if (tarGetField.getType().equals(Double.class)) {
                        tarGetField.set(retData, Double.valueOf(oneItem.getEndValue()));
                    } else {
                        tarGetField.set(retData, oneItem.getEndValue());
                    }
                } catch (IllegalAccessException e) {
                    e.printStackTrace();
                }
            }

        }
        return retData;
    }

    /**
     * code:columnToRow
     * name:M2转换配置项转答案(特殊方法）
     * desc:undefined
     * gen by moon at 7/24/2022, 4:51:09 PM
     **/
    @Trace(operationName = "M2转换配置项转答案(特殊方法）")
    @Tags({@Tag(key = "参数", value = "arg[0]"),
            @Tag(key = "返回值", value = "returnedObj")})
    public SchemeConfItemTransitionConfItemToAnswerRespDto schemeConfItemTransitionConfItemToAnswer(SchemeConfItemTransitionConfItemToAnswerReqDto reqDto) {
        SchemeConfItemTransitionConfItemToAnswerRespDto retData = new SchemeConfItemTransitionConfItemToAnswerRespDto();
        Field[] declaredFields = SchemeConfItemTransitionConfItemToAnswerRespDto.class.getDeclaredFields();
        Map<String, Field> tarGetValueIndex = new HashMap<>();
        for (Field field : declaredFields) {
            tarGetValueIndex.put(field.getName(), field);
        }
        for (ConfSchemeItemResultDto oneItem : reqDto.getConfSchemeItemResultList()) {
            retData.setConfSchemeId(oneItem.getConfSchemeId());
            Field tarGetField = tarGetValueIndex.get(CommonFunctionHelper.underlineToHump(oneItem.getConfItemCode()));
            if (tarGetField != null) {
                try {
                    tarGetField.setAccessible(true);
                    if (tarGetField.getType().equals(Long.class)) {
                        tarGetField.set(retData, Long.valueOf(oneItem.getEndValue()));
                    } else if (tarGetField.getType().equals(String.class)) {
                        tarGetField.set(retData, String.valueOf(oneItem.getEndValue()));
                    } else if (tarGetField.getType().equals(Double.class)) {
                        tarGetField.set(retData, Double.valueOf(oneItem.getEndValue()));
                    } else {
                        tarGetField.set(retData, oneItem.getEndValue());
                    }
                } catch (IllegalAccessException e) {
                    e.printStackTrace();
                }
            }

        }
        return retData;
    }

    /**
     * code:columnToRow
     * name:M2转换配置项转答案(特殊方法）
     * desc:undefined
     * gen by moon at 8/17/2022, 7:58:49 PM
     **/
    @Trace(operationName = "M2转换配置项转答案(特殊方法）")
    @Tags({@Tag(key = "参数", value = "arg[0]"),
            @Tag(key = "返回值", value = "returnedObj")})
    public SchemeExampleConfItemTransitionConfItemToAnswerRespDto schemeExampleConfItemTransitionConfItemToAnswer(SchemeExampleConfItemTransitionConfItemToAnswerReqDto reqDto) {
        SchemeExampleConfItemTransitionConfItemToAnswerRespDto retData = new SchemeExampleConfItemTransitionConfItemToAnswerRespDto();
        Field[] declaredFields = SchemeExampleConfItemTransitionConfItemToAnswerRespDto.class.getDeclaredFields();
        Map<String, Field> tarGetValueIndex = new HashMap<>();
        for (Field field : declaredFields) {
            tarGetValueIndex.put(field.getName(), field);
        }
        for (ConfSchemeItemResultDto oneItem : reqDto.getConfSchemeItemResultList()) {
            retData.setConfSchemeId(oneItem.getConfSchemeId());
            Field tarGetField = tarGetValueIndex.get(CommonFunctionHelper.underlineToHump(oneItem.getConfItemCode()));
            if (tarGetField != null) {
                try {
                    tarGetField.setAccessible(true);
                    if (tarGetField.getType().equals(Long.class)) {
                        tarGetField.set(retData, Long.valueOf(oneItem.getEndValue()));
                    } else if (tarGetField.getType().equals(String.class)) {
                        tarGetField.set(retData, String.valueOf(oneItem.getEndValue()));
                    } else if (tarGetField.getType().equals(Double.class)) {
                        tarGetField.set(retData, Double.valueOf(oneItem.getEndValue()));
                    } else {
                        tarGetField.set(retData, oneItem.getEndValue());
                    }
                } catch (IllegalAccessException e) {
                    e.printStackTrace();
                }
            }

        }
        return retData;
    }

    /**
     * code:columnToRow
     * name:M2转换配置项转答案(特殊方法）
     * desc:undefined
     * gen by moon at 8/21/2022, 4:35:57 AM
     **/
    @Trace(operationName = "M2转换配置项转答案(特殊方法）")
    @Tags({@Tag(key = "参数", value = "arg[0]"),
            @Tag(key = "返回值", value = "returnedObj")})
    public SchemeTempClassItemTransitionConfItemToAnswerRespDto schemeTempClassItemTransitionConfItemToAnswer(SchemeTempClassItemTransitionConfItemToAnswerReqDto reqDto) {
        SchemeTempClassItemTransitionConfItemToAnswerRespDto retData = new SchemeTempClassItemTransitionConfItemToAnswerRespDto();
        Field[] declaredFields = SchemeTempClassItemTransitionConfItemToAnswerRespDto.class.getDeclaredFields();
        Map<String, Field> tarGetValueIndex = new HashMap<>();
        for (Field field : declaredFields) {
            tarGetValueIndex.put(field.getName(), field);
        }
        for (ConfSchemeItemResultDto oneItem : reqDto.getConfSchemeItemResultList()) {
            retData.setConfSchemeId(oneItem.getConfSchemeId());
            Field tarGetField = tarGetValueIndex.get(CommonFunctionHelper.underlineToHump(oneItem.getConfItemCode()));
            if (tarGetField != null) {
                try {
                    tarGetField.setAccessible(true);
                    if (tarGetField.getType().equals(Long.class)) {
                        tarGetField.set(retData, Long.valueOf(oneItem.getEndValue()));
                    } else if (tarGetField.getType().equals(String.class)) {
                        tarGetField.set(retData, String.valueOf(oneItem.getEndValue()));
                    } else if (tarGetField.getType().equals(Double.class)) {
                        tarGetField.set(retData, Double.valueOf(oneItem.getEndValue()));
                    } else {
                        tarGetField.set(retData, oneItem.getEndValue());
                    }
                } catch (IllegalAccessException e) {
                    e.printStackTrace();
                }
            }

        }
        return retData;
    }

    /**
     * code:columnToRow
     * name:M2转换配置项转答案(特殊方法）
     * desc:undefined
     * gen by moon at 8/21/2022, 4:36:21 AM
     **/
    @Trace(operationName = "M2转换配置项转答案(特殊方法）")
    @Tags({@Tag(key = "参数", value = "arg[0]"),
            @Tag(key = "返回值", value = "returnedObj")})
    public SchemeClassItemTransitionConfItemToAnswerRespDto schemeClassItemTransitionConfItemToAnswer(SchemeClassItemTransitionConfItemToAnswerReqDto reqDto) {
        SchemeClassItemTransitionConfItemToAnswerRespDto retData = new SchemeClassItemTransitionConfItemToAnswerRespDto();
        Field[] declaredFields = SchemeClassItemTransitionConfItemToAnswerRespDto.class.getDeclaredFields();
        Map<String, Field> tarGetValueIndex = new HashMap<>();
        for (Field field : declaredFields) {
            tarGetValueIndex.put(field.getName(), field);
        }
        for (ConfSchemeItemResultDto oneItem : reqDto.getConfSchemeItemResultList()) {
            retData.setConfSchemeId(oneItem.getConfSchemeId());
            Field tarGetField = tarGetValueIndex.get(CommonFunctionHelper.underlineToHump(oneItem.getConfItemCode()));
            if (tarGetField != null) {
                try {
                    tarGetField.setAccessible(true);
                    if (tarGetField.getType().equals(Long.class)) {
                        tarGetField.set(retData, Long.valueOf(oneItem.getEndValue()));
                    } else if (tarGetField.getType().equals(String.class)) {
                        tarGetField.set(retData, String.valueOf(oneItem.getEndValue()));
                    } else if (tarGetField.getType().equals(Double.class)) {
                        tarGetField.set(retData, Double.valueOf(oneItem.getEndValue()));
                    } else {
                        tarGetField.set(retData, oneItem.getEndValue());
                    }
                } catch (IllegalAccessException e) {
                    e.printStackTrace();
                }
            }

        }
        return retData;
    }

    /**
     * code:columnToRow
     * name:M2转换配置项转答案(特殊方法）
     * desc:undefined
     * gen by moon at 8/28/2022, 4:03:11 PM
     **/
    @Trace(operationName = "M2转换配置项转答案(特殊方法）")
    @Tags({@Tag(key = "参数", value = "arg[0]"),
            @Tag(key = "返回值", value = "returnedObj")})
    public SchemeTempConfItemTransitionConfItemToAnswerRespDto schemeTempConfItemTransitionConfItemToAnswer(SchemeTempConfItemTransitionConfItemToAnswerReqDto reqDto) {
        SchemeTempConfItemTransitionConfItemToAnswerRespDto retData = new SchemeTempConfItemTransitionConfItemToAnswerRespDto();
        Field[] declaredFields = SchemeTempConfItemTransitionConfItemToAnswerRespDto.class.getDeclaredFields();
        Map<String, Field> tarGetValueIndex = new HashMap<>();
        for (Field field : declaredFields) {
            tarGetValueIndex.put(field.getName(), field);
        }
        for (ConfSchemeItemResultDto oneItem : reqDto.getConfSchemeItemResultList()) {
            retData.setConfSchemeId(oneItem.getConfSchemeId());
            Field tarGetField = tarGetValueIndex.get(CommonFunctionHelper.underlineToHump(oneItem.getConfItemCode()));
            if (tarGetField != null) {
                try {
                    tarGetField.setAccessible(true);
                    if (tarGetField.getType().equals(Long.class)) {
                        tarGetField.set(retData, Long.valueOf(oneItem.getEndValue()));
                    } else if (tarGetField.getType().equals(String.class)) {
                        tarGetField.set(retData, String.valueOf(oneItem.getEndValue()));
                    } else if (tarGetField.getType().equals(Double.class)) {
                        tarGetField.set(retData, Double.valueOf(oneItem.getEndValue()));
                    } else {
                        tarGetField.set(retData, oneItem.getEndValue());
                    }
                } catch (IllegalAccessException e) {
                    e.printStackTrace();
                }
            }

        }
        return retData;
    }

    /**
     * code:rowToColumn
     * name:M2转换配置项转答案(特殊方法）
     * desc:undefined
     * gen by moon at 9/6/2022, 2:42:39 AM
     **/
    @Trace(operationName = "M2转换配置项转答案(特殊方法）")
    @Tags({@Tag(key = "参数", value = "arg[0]"),
            @Tag(key = "返回值", value = "returnedObj")})
    public SchemeOptionItemTransitionConfItemToAnswerRespDto schemeOptionItemTransitionConfItemToAnswer(SchemeOptionItemTransitionConfItemToAnswerReqDto reqDto) {
        SchemeOptionItemTransitionConfItemToAnswerRespDto retData = new SchemeOptionItemTransitionConfItemToAnswerRespDto();
        Field[] declaredFields = SchemeOptionItemTransitionConfItemToAnswerRespDto.class.getDeclaredFields();
        Map<String, Field> tarGetValueIndex = new HashMap<>();
        for (Field field : declaredFields) {
            tarGetValueIndex.put(field.getName(), field);
        }
        for (ConfSchemeItemResultDto oneItem : reqDto.getConfSchemeItemResultList()) {
            retData.setConfSchemeId(oneItem.getConfSchemeId());
            Field tarGetField = tarGetValueIndex.get(CommonFunctionHelper.underlineToHump(oneItem.getConfItemCode()));
            if (tarGetField != null) {
                try {
                    tarGetField.setAccessible(true);
                    if (tarGetField.getType().equals(Long.class)) {
                        tarGetField.set(retData, Long.valueOf(oneItem.getEndValue()));
                    } else if (tarGetField.getType().equals(String.class)) {
                        tarGetField.set(retData, String.valueOf(oneItem.getEndValue()));
                    } else if (tarGetField.getType().equals(Double.class)) {
                        tarGetField.set(retData, Double.valueOf(oneItem.getEndValue()));
                    } else {
                        tarGetField.set(retData, oneItem.getEndValue());
                    }
                } catch (IllegalAccessException e) {
                    e.printStackTrace();
                }
            }

        }
        return retData;
    }

    /**
     * code:receptionService
     * name:M2-获取接收字段
     * desc:undefined
     * gen by moon at 9/8/2022, 3:40:35 AM
     **/
    @Trace(operationName = "M2-获取接收字段")
    @Tags({@Tag(key = "参数", value = "arg[0]"),
            @Tag(key = "返回值", value = "returnedObj")})
    public ObtainReceiveFieldsRespDto obtainReceiveFields(ObtainReceiveFieldsReqDto reqDto) {
        return BeanUtil.toBean(reqDto, ObtainReceiveFieldsRespDto.class);
    }

    /**
     * code:maxOfMultipleNumAddOne
     * name:M2-获取数据集最大值加一（特殊方法）
     * desc:undefined
     * gen by moon at 9/19/2022, 6:21:54 PM
     **/
    @Trace(operationName = "M2-获取数据集最大值加一（特殊方法）")
    @Tags({@Tag(key = "参数", value = "arg[0]"),
            @Tag(key = "返回值", value = "returnedObj")})
    public ObtainMaxOfCollectionsAddOneRespDto obtainMaxOfCollectionsAddOne(ObtainMaxOfCollectionsAddOneReqDto reqDto) {
        ObtainMaxOfCollectionsAddOneRespDto retData = new ObtainMaxOfCollectionsAddOneRespDto();
        if (reqDto.getMaxOfMultipleNumList() == null || reqDto.getMaxOfMultipleNumList().size() == 0) {
            retData.setOrderNumber(1L);
            return retData;
        }
        retData.setOrderNumber(Collections.max(reqDto.getMaxOfMultipleNumList()) + 1);
        return retData;
    }

    /**
     * code:multiColumnToMultiRow
     * name:M2-执行多列选项标识转多行答案（特殊方法）
     * desc:undefined
     * gen by moon at 12/1/2022, 3:34:01 PM
     **/
    @Trace(operationName = "M2-执行多列选项标识转多行答案（特殊方法）")
    @Tags({@Tag(key = "参数", value = "arg[0]"),
            @Tag(key = "返回值", value = "returnedObj")})
    public ImplementMultitermOptionCodeTransitionMultirowResultRespDto implementMultitermOptionCodeTransitionMultirowResult(ImplementMultitermOptionCodeTransitionMultirowResultReqDto reqDto) {

        ImplementMultitermOptionCodeTransitionMultirowResultRespDto retData = new ImplementMultitermOptionCodeTransitionMultirowResultRespDto();
        Field[] declaredFields = ImplementMultitermOptionCodeTransitionMultirowResultRespDto.class.getDeclaredFields();
        Map<String, Field> tarGetValueIndex = new HashMap<>();
        for (Field field : declaredFields) {
            tarGetValueIndex.put(field.getName(), field);
        }
        for (MultitermOptionCodeTransitionMultirowResultDto oneOption : reqDto.getMultitermOptionCodeTransitionMultirowResultList()) {
            Field tarGetField = tarGetValueIndex.get(CommonFunctionHelper.underlineToHump(oneOption.getConfOptionCode()));
            if (tarGetField != null) {
                try {
                    tarGetField.setAccessible(true);
                    if (tarGetField.getType().equals(Long.class)) {
                        tarGetField.set(retData, Long.valueOf(oneOption.getEndValue()));
                    } else if (tarGetField.getType().equals(Long.class)) {
                        tarGetField.set(retData, Long.valueOf(oneOption.getEndValue()));
                    } else {
                        tarGetField.set(retData, oneOption.getEndValue());
                    }
                } catch (IllegalAccessException e) {
                    e.printStackTrace();
                }
            }

        }
        return retData;
    }

    /**
     * code:columnToRow
     * name:M2-执行选项结果转答案
     * desc:undefined
     * gen by moon at 2/27/2023, 6:53:49 PM
     **/
    @Trace(operationName = "M2-执行选项结果转答案")
    @Tags({@Tag(key = "参数", value = "arg[0]"),
            @Tag(key = "返回值", value = "returnedObj")})
    public ImplementColumnToRowAnswerRespDto implementColumnToRowAnswer(ImplementColumnToRowAnswerReqDto reqDto) {
        ImplementColumnToRowAnswerRespDto retData = new ImplementColumnToRowAnswerRespDto();
        Field[] declaredFields = ImplementColumnToRowAnswerRespDto.class.getDeclaredFields();
        Map<String, Field> tarGetValueIndex = new HashMap<>();
        for (Field field : declaredFields) {
            tarGetValueIndex.put(field.getName(), field);
        }
        for (ConfSchemeItemResultDto oneOption : reqDto.getConfSchemeItemResultList()) {
            Field tarGetField = tarGetValueIndex.get(CommonFunctionHelper.underlineToHump(oneOption.getConfOptionCode()));
            if (tarGetField != null) {
                try {
                    tarGetField.setAccessible(true);
                    if (tarGetField.getType().equals(Long.class)) {
                        tarGetField.set(retData, Long.valueOf(oneOption.getEndValue()));
                    } else if (tarGetField.getType().equals(Long.class)) {
                        tarGetField.set(retData, Long.valueOf(oneOption.getEndValue()));
                    } else {
                        tarGetField.set(retData, oneOption.getEndValue());
                    }
                } catch (IllegalAccessException e) {
                    e.printStackTrace();
                }
            }

        }
        return retData;
    }

    /**
     * code:dataStochasticOne
     * name:M2随机一条通用背景图配置项标识
     * desc:undefined
     * gen by moon at 6/27/2023, 11:24:35 PM
     **/
    @Trace(operationName = "M2随机一条通用背景图配置项标识")
    @Tags({@Tag(key = "参数", value = "arg[0]"),
            @Tag(key = "返回值", value = "returnedObj")})
    public ObtainDataStochasticOneRespDto obtainDataStochasticOne(ObtainDataStochasticOneReqDto reqDto) {
        ObtainDataStochasticOneRespDto retData = new ObtainDataStochasticOneRespDto();
        if (CollectionUtil.isNotEmpty(reqDto.getDataStochasticOneList())) {
            int randomNumber = CommonFunctionHelper.random.nextInt(reqDto.getDataStochasticOneList().size()); // 生成0到10的随机整数
            retData.setCustomField(reqDto.getDataStochasticOneList().get(randomNumber));
        }
        return retData;
    }

    /**
     * code:receptionService
     * name:M2接收消息发送方配置答案
     * desc:undefined
     * gen by moon at 12/29/2023, 7:05:08 PM
     **/
    @Trace(operationName = "M2接收消息发送方配置答案")
    @Tags({@Tag(key = "参数", value = "arg[0]"),
            @Tag(key = "返回值", value = "returnedObj")})
    public ImplementSmartSessionReceiveFieldInputRespDto implementSmartSessionReceiveFieldInput(ImplementSmartSessionReceiveFieldInputReqDto reqDto) {
        return BeanUtil.toBean(reqDto, ImplementSmartSessionReceiveFieldInputRespDto.class);

    }

    /**
     * code:receptionService
     * name:M2-接收入参字段
     * desc:undefined
     * gen by moon at 3/27/2024, 1:01:46 AM
     **/
    @Trace(operationName = "M2-接收入参字段")
    @Tags({@Tag(key = "参数", value = "arg[0]"),
            @Tag(key = "返回值", value = "returnedObj")})
    public ImplementTenReceivingFieldRespDto implementTenReceivingField(ImplementTenReceivingFieldReqDto reqDto) {
        return BeanUtil.toBean(reqDto, ImplementTenReceivingFieldRespDto.class);
    }

    // 手工接入方法
}
